﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Core;
using Models;

namespace Controllers
{
    public class LogController : AdminBaseController
    {
        logCore core = new logCore();
        public ActionResult GetList(pageinfo pageinfo)
        {
            if (!HasQx("log"))
            {
                return Error("没有权限！");
            }
            string where = string.Empty;
            var list = core.GetPageList(pageinfo.page,pageinfo.pagesize, where, pageinfo.order+" "+pageinfo.esc);
            return Success(list);
        }

        [HttpPost]
        public ActionResult Del()
        {
            if (!HasQx("log"))
            {
                return Error("没有权限！");
            }
            if (core.Del())
            {
                Log(curmanage.username + "删除了一周前的日志");
                return Success("删除成功！");
            }
            return Error("删除失败！");
        }
    }
}
